package com.cacshanghai.cac_oa_client.ui;

import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.cacshanghai.cac_oa_client.R;

/**
 * Created by geyh on 2016/5/25.
 */
public class BaseActivity extends AppCompatActivity {

    public void setTitle(String title) {
        TextView tv_title = (TextView) findViewById(R.id.tv_title);
        tv_title.setText(title);
    }

    public void setBack() {
        ImageView iv_back = (ImageView) findViewById(R.id.iv_back);
        iv_back.setVisibility(View.VISIBLE);
        iv_back.findViewById(R.id.iv_back).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
    }

    public void setTitleRightImageView(int resId, View.OnClickListener clickListener) {
        ImageView iv_right = (ImageView) findViewById(R.id.iv_right);
        iv_right.setVisibility(View.VISIBLE);
        iv_right.setImageResource(resId);
        iv_right.setOnClickListener(clickListener);
    }
}
